import React, { useState ,useEffect} from 'react';
import {
    Button,
    Cascader,
    DatePicker,
    Form,
    Input,
    InputNumber,
    Radio,
    Select,
    Switch,
    TreeSelect,
} from 'antd';
const Myform = (props) => {
    //编辑回显
    useEffect(()=>{
        if(props.title=='编辑订单'){
            form.setFieldsValue(props.itemobj)
        }
    },[props.title,props.itemobj])
    //表单实例
    const [form] = Form.useForm();
    const onFinish = (values) => {
        props.handleFormSubmit(values);
    }
    return (
        <Form
            form={form}
            onFinish={onFinish}
            style={{ maxWidth: 600 }}
        >
            <Form.Item label="订单编号" name="key">
                <Input placeholder='请输入订单编号'
                    rules={[{ required: true, message: '请输入订单编号!' }]}
                />
            </Form.Item>
            <Form.Item label="订单标题" name="name">
                <Input placeholder='请输入订单标题'
                    rules={[{ required: true, message: '请输入订单标题!' }]}
                />
            </Form.Item>
            <Form.Item label="关联客户" name="kehu">
                <Input placeholder='请输入关联客户'
                    rules={[{ required: true, message: '请输入关联客户!' }]}
                />
            </Form.Item>
            <Form.Item label="审批状态" name="Collor">
                <Select>
                    <Select.Option value="已通过">已通过</Select.Option>
                    <Select.Option value="被否决">被否决</Select.Option>
                    <Select.Option value="已撤销">已撤销</Select.Option>
                    <Select.Option value="待审批">待审批</Select.Option>
                    <Select.Option value="未提交">未提交</Select.Option>
                </Select>
            </Form.Item>
            <Form.Item label="订单总金额" name="price">
                <Input placeholder='请输入订单总金额'
                    rules={[{ required: true, message: '请输入订单总金额!' }]}
                />
            </Form.Item>
            <Form.Item label="已回款金额" name="yprice">
                <Input placeholder='请输入已回款金额'
                    rules={[{ required: true, message: '请输入已回款金额!' }]}
                />
            </Form.Item>
            <Form.Item label="已开票金额" name="kprice">
                <Input placeholder='请输入已开票金额'
                    rules={[{ required: true, message: '请输入已开票金额!' }]}
                />
            </Form.Item>
            <Form.Item>
                <Button htmlType='submit'>确定</Button>
            </Form.Item>
        </Form>
    );
};
export default Myform;